package com.zlp.feign;
import com.zlp.config.FeignMultipartSupportConfig;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(
        contextId = "userDownFeign",
        name = "user-service",
        configuration = FeignMultipartSupportConfig.class

)
public interface FileDownFeign {

    @PostMapping(value = "/v1/download",consumes = MediaType.APPLICATION_JSON_VALUE)
    byte[] download(@RequestParam(value = "fileUrl") String fileUrl);

    @PostMapping(value = "/v1/getObject",consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE)
    ResponseEntity<byte[]> getObject(String downFileUrl);

    @GetMapping("/downloadFile")
    ResponseEntity<byte[]> downloadFile(@RequestParam(value = "fileType")  String fileType) ;

    @GetMapping(value = "/downloadFile",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Response downloadFile();
}


